import 'package:flutter/material.dart';
import './my/cv.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:gksz/nav/nav.dart';

void main(){
  runApp(MyApp());
  }

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: '广科思政',
      theme: ThemeData(
        // primarySwatch: Colors.red,
        primaryColor:Colors.red[700]
      ),
      home: Sharehome(),
      debugShowCheckedModeBanner: false,
    );
  }
}

class Sharehome extends StatefulWidget {
  Sharehome({Key key}) : super(key: key);
// var name;
  _SharehomeState createState() => _SharehomeState();
}

class _SharehomeState extends State<Sharehome> {
 @override
  void initState() {
    // TODO: implement initState
    super.initState();
    getshare();
  }
  var isnull;
  Future getshare() async {
    SharedPreferences sharedPreferences = await SharedPreferences.getInstance();
      isnull = sharedPreferences.getString('username');
      setState(() {});
  }
  @override
  Widget build(BuildContext context) {
    return isnull != null?Nav():Loginpage();
  }
}
